package com.sf.leetcode.primary_alogrithm;

import java.util.Arrays;

public class rotate {
    public static void main(String[] args) {
        int[] nums={-1,-100,3,99};
        int k = 2;
        rotate(nums,k);
        System.out.println(Arrays.toString(nums));
    }

    public static void rotate(int[] nums, int k){
        //时间复杂度高，需修改
        for(int i = 1;i <= k;i++){
            int temp = nums[nums.length - 1];
            for (int j = 0; j<nums.length -1;j++){
                nums[nums.length - j - 1] = nums[nums.length - j - 2];
            }
            nums[0] = temp;

        }
    }
}
